const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sunnyDictBiz', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    tenantId: {
      type: DataTypes.STRING(12),
      allowNull: true,
      comment: "租户ID",
      field: 'tenant_id'
    },
    parentId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: 0,
      comment: "父主键",
      field: 'parent_id'
    },
    code: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "字典码"
    },
    dictKey: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "字典值",
      field: 'dict_key'
    },
    dictValue: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "字典名称",
      field: 'dict_value'
    },
    sort: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "排序"
    },
    remark: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "字典备注"
    },
    isSealed: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
      comment: "是否已封存",
      field: 'is_sealed'
    },
    isDeleted: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
      comment: "是否已删除",
      field: 'is_deleted'
    }
  }, {
    sequelize,
    tableName: 'sunny_dict_biz',
    timestamps: true,
    createdAt: 'createTime',
    updatedAt: 'updateTime',
    deletedAt: 'deleteTime',
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
